/**
 * This software is copyrighted by Bosch Connected Devices and Solutions GmbH, 2016.
 * The use of this software is subject to the XDK SDK EULA
 */

/* system header files */

/* own header files */
#include "BCDS_SensorErrorType.h"

/* additional interface header files */


/* functions */

/* API documentation is in public interface header file 'BCDS_SensorErrorType.h' */

BCDS_SensorErrorType_T BCDS_getSensorErrorCode(Retcode_T sensorApiReturnValue)
{
    Retcode_T tempReturnValue = (sensorApiReturnValue & UINT32_C(0x0000FFFF));
    BCDS_SensorErrorType_T returnValue = SENSOR_ERROR;

    if ((Retcode_T) RETCODE_OK == tempReturnValue)
    {
        returnValue = SENSOR_SUCCESS;
    }
    else if ((Retcode_T) RETCODE_INVALID_PARAM == tempReturnValue)
    {
        returnValue = SENSOR_INVALID_PARAMETER;
    }
    else if ((Retcode_T) RETCODE_UNINITIALIZED == tempReturnValue)
    {
        returnValue = SENSOR_INIT_NOT_DONE;
    }
    else if ((Retcode_T) RETCODE_NOT_SUPPORTED == tempReturnValue)
    {
        returnValue = SENSOR_UNSUPPORTED_PARAMETER;
    }
    else
    {
        returnValue = SENSOR_ERROR;
    }

    return (returnValue);
}


